package com.ssish.saas.eccs.mapper;

import com.ssish.saas.eccs.model.Coverage;
import com.ssish.saas.eccs.model.CoverageExample;
import com.ssish.saas.eccs.model.CoverageKey;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface CoverageMapper {
    long countByExample(CoverageExample example);

    int deleteByExample(CoverageExample example);

    @Delete({
        "delete from COVERAGE",
        "where CORP_CODE = #{corpCode,jdbcType=VARCHAR}",
          "and PLAN_CODE = #{planCode,jdbcType=VARCHAR}",
          "and COVERAGE_CODE = #{coverageCode,jdbcType=CHAR}"
    })
    int deleteByPrimaryKey(CoverageKey key);

    @Insert({
        "insert into COVERAGE (CORP_CODE, PLAN_CODE, ",
        "COVERAGE_CODE, USER_CODE, ",
        "LASTEDIT_DATE, ACTIVE_FLAG, ",
        "LOA_DESC, SUB_COVERAGE_CODE, ",
        "ENGLISH_DESC, RESERVE_AMT, ",
        "PREVALIDITY, POSTVALIDITY, ",
        "POSTFRDT, PREAUTH_VALIDITY, ",
        "LOA_NOTE, WAITING_PERIOD, ",
        "MEMBER_ENTITLED, ACCOP_VALIDITY, ",
        "START_DATE, END_DATE, ",
        "POSTCASHLESS, CONDITION_BASE_DATE, ",
        "REMARKS, ACCOP_POSTVALIDITY, ",
        "PREAUTH_REQUIRED, MOBILE_NOTE, ",
        "MOBILE_ENGLISH_NOTE, EDCMAX_VALUE, ",
        "CASHLESS_FACILITY, VISIT_RESTRICTED_PROVIDER_ONLY, ",
        "CLAIMS_SUBMISSION_VALIDITY, PREAUTH_REQUIRED_AMT_INCURRED, ",
        "REFERRAL_NETWORK_CODE, INSERT_BY, ",
        "INSERT_DATE, PREAUTH_MAXUSE, ",
        "REFERRAL_REQUIRED, REFERRAL_VALIDITY, ",
        "REFERRAL_MAXUSE, REIMBURSE_FACILITY)",
        "values (#{corpCode,jdbcType=VARCHAR}, #{planCode,jdbcType=VARCHAR}, ",
        "#{coverageCode,jdbcType=CHAR}, #{userCode,jdbcType=VARCHAR}, ",
        "#{lasteditDate,jdbcType=TIMESTAMP}, #{activeFlag,jdbcType=CHAR}, ",
        "#{loaDesc,jdbcType=OTHER}, #{subCoverageCode,jdbcType=CHAR}, ",
        "#{englishDesc,jdbcType=VARCHAR}, #{reserveAmt,jdbcType=DECIMAL}, ",
        "#{prevalidity,jdbcType=DECIMAL}, #{postvalidity,jdbcType=DECIMAL}, ",
        "#{postfrdt,jdbcType=CHAR}, #{preauthValidity,jdbcType=DECIMAL}, ",
        "#{loaNote,jdbcType=OTHER}, #{waitingPeriod,jdbcType=DECIMAL}, ",
        "#{memberEntitled,jdbcType=VARCHAR}, #{accopValidity,jdbcType=DECIMAL}, ",
        "#{startDate,jdbcType=TIMESTAMP}, #{endDate,jdbcType=TIMESTAMP}, ",
        "#{postcashless,jdbcType=CHAR}, #{conditionBaseDate,jdbcType=CHAR}, ",
        "#{remarks,jdbcType=VARCHAR}, #{accopPostvalidity,jdbcType=DECIMAL}, ",
        "#{preauthRequired,jdbcType=CHAR}, #{mobileNote,jdbcType=VARCHAR}, ",
        "#{mobileEnglishNote,jdbcType=VARCHAR}, #{edcmaxValue,jdbcType=DECIMAL}, ",
        "#{cashlessFacility,jdbcType=CHAR}, #{visitRestrictedProviderOnly,jdbcType=CHAR}, ",
        "#{claimsSubmissionValidity,jdbcType=DECIMAL}, #{preauthRequiredAmtIncurred,jdbcType=DECIMAL}, ",
        "#{referralNetworkCode,jdbcType=VARCHAR}, #{insertBy,jdbcType=VARCHAR}, ",
        "#{insertDate,jdbcType=TIMESTAMP}, #{preauthMaxuse,jdbcType=DECIMAL}, ",
        "#{referralRequired,jdbcType=CHAR}, #{referralValidity,jdbcType=DECIMAL}, ",
        "#{referralMaxuse,jdbcType=DECIMAL}, #{reimburseFacility,jdbcType=CHAR})"
    })
    int insert(Coverage record);

    int insertSelective(Coverage record);

    List<Coverage> selectByExample(CoverageExample example);

    @Select({
        "select",
        "CORP_CODE, PLAN_CODE, COVERAGE_CODE, USER_CODE, LASTEDIT_DATE, ACTIVE_FLAG, ",
        "LOA_DESC, SUB_COVERAGE_CODE, ENGLISH_DESC, RESERVE_AMT, PREVALIDITY, POSTVALIDITY, ",
        "POSTFRDT, PREAUTH_VALIDITY, LOA_NOTE, WAITING_PERIOD, MEMBER_ENTITLED, ACCOP_VALIDITY, ",
        "START_DATE, END_DATE, POSTCASHLESS, CONDITION_BASE_DATE, REMARKS, ACCOP_POSTVALIDITY, ",
        "PREAUTH_REQUIRED, MOBILE_NOTE, MOBILE_ENGLISH_NOTE, EDCMAX_VALUE, CASHLESS_FACILITY, ",
        "VISIT_RESTRICTED_PROVIDER_ONLY, CLAIMS_SUBMISSION_VALIDITY, PREAUTH_REQUIRED_AMT_INCURRED, ",
        "REFERRAL_NETWORK_CODE, INSERT_BY, INSERT_DATE, PREAUTH_MAXUSE, REFERRAL_REQUIRED, ",
        "REFERRAL_VALIDITY, REFERRAL_MAXUSE, REIMBURSE_FACILITY",
        "from COVERAGE",
        "where CORP_CODE = #{corpCode,jdbcType=VARCHAR}",
          "and PLAN_CODE = #{planCode,jdbcType=VARCHAR}",
          "and COVERAGE_CODE = #{coverageCode,jdbcType=CHAR}"
    })
    @ResultMap("com.ssish.saas.eccs.mapper.CoverageMapper.BaseResultMap")
    Coverage selectByPrimaryKey(CoverageKey key);

    int updateByExampleSelective(@Param("record") Coverage record, @Param("example") CoverageExample example);

    int updateByExample(@Param("record") Coverage record, @Param("example") CoverageExample example);

    int updateByPrimaryKeySelective(Coverage record);

    @Update({
        "update COVERAGE",
        "set USER_CODE = #{userCode,jdbcType=VARCHAR},",
          "LASTEDIT_DATE = #{lasteditDate,jdbcType=TIMESTAMP},",
          "ACTIVE_FLAG = #{activeFlag,jdbcType=CHAR},",
          "LOA_DESC = #{loaDesc,jdbcType=OTHER},",
          "SUB_COVERAGE_CODE = #{subCoverageCode,jdbcType=CHAR},",
          "ENGLISH_DESC = #{englishDesc,jdbcType=VARCHAR},",
          "RESERVE_AMT = #{reserveAmt,jdbcType=DECIMAL},",
          "PREVALIDITY = #{prevalidity,jdbcType=DECIMAL},",
          "POSTVALIDITY = #{postvalidity,jdbcType=DECIMAL},",
          "POSTFRDT = #{postfrdt,jdbcType=CHAR},",
          "PREAUTH_VALIDITY = #{preauthValidity,jdbcType=DECIMAL},",
          "LOA_NOTE = #{loaNote,jdbcType=OTHER},",
          "WAITING_PERIOD = #{waitingPeriod,jdbcType=DECIMAL},",
          "MEMBER_ENTITLED = #{memberEntitled,jdbcType=VARCHAR},",
          "ACCOP_VALIDITY = #{accopValidity,jdbcType=DECIMAL},",
          "START_DATE = #{startDate,jdbcType=TIMESTAMP},",
          "END_DATE = #{endDate,jdbcType=TIMESTAMP},",
          "POSTCASHLESS = #{postcashless,jdbcType=CHAR},",
          "CONDITION_BASE_DATE = #{conditionBaseDate,jdbcType=CHAR},",
          "REMARKS = #{remarks,jdbcType=VARCHAR},",
          "ACCOP_POSTVALIDITY = #{accopPostvalidity,jdbcType=DECIMAL},",
          "PREAUTH_REQUIRED = #{preauthRequired,jdbcType=CHAR},",
          "MOBILE_NOTE = #{mobileNote,jdbcType=VARCHAR},",
          "MOBILE_ENGLISH_NOTE = #{mobileEnglishNote,jdbcType=VARCHAR},",
          "EDCMAX_VALUE = #{edcmaxValue,jdbcType=DECIMAL},",
          "CASHLESS_FACILITY = #{cashlessFacility,jdbcType=CHAR},",
          "VISIT_RESTRICTED_PROVIDER_ONLY = #{visitRestrictedProviderOnly,jdbcType=CHAR},",
          "CLAIMS_SUBMISSION_VALIDITY = #{claimsSubmissionValidity,jdbcType=DECIMAL},",
          "PREAUTH_REQUIRED_AMT_INCURRED = #{preauthRequiredAmtIncurred,jdbcType=DECIMAL},",
          "REFERRAL_NETWORK_CODE = #{referralNetworkCode,jdbcType=VARCHAR},",
          "INSERT_BY = #{insertBy,jdbcType=VARCHAR},",
          "INSERT_DATE = #{insertDate,jdbcType=TIMESTAMP},",
          "PREAUTH_MAXUSE = #{preauthMaxuse,jdbcType=DECIMAL},",
          "REFERRAL_REQUIRED = #{referralRequired,jdbcType=CHAR},",
          "REFERRAL_VALIDITY = #{referralValidity,jdbcType=DECIMAL},",
          "REFERRAL_MAXUSE = #{referralMaxuse,jdbcType=DECIMAL},",
          "REIMBURSE_FACILITY = #{reimburseFacility,jdbcType=CHAR}",
        "where CORP_CODE = #{corpCode,jdbcType=VARCHAR}",
          "and PLAN_CODE = #{planCode,jdbcType=VARCHAR}",
          "and COVERAGE_CODE = #{coverageCode,jdbcType=CHAR}"
    })
    int updateByPrimaryKey(Coverage record);
}